package pl.edu.agh.lab2.sr.gameServer;

import java.rmi.Naming;
import java.rmi.server.UnicastRemoteObject;

import pl.edu.agh.lab2.sr.beans.ConfigReader;
import pl.edu.agh.lab2.sr.remoteInterfaces.IGameServer;

public class SampleServer {

	private static IGameServer server;

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		try {
			String battleshipServerObjectPath = ConfigReader
					.getServerObjectPath();
			System.out.println(battleshipServerObjectPath);
			// String battleshipServerObjectPath =
			// "rmi://127.0.0.1:1099/battleship";
			server = new GameServerImpl();

			IGameServer exportedSrv = (IGameServer) UnicastRemoteObject
					.exportObject(server, 0);

			Naming.rebind(battleshipServerObjectPath, exportedSrv);
		} catch (Exception e) {
			System.err.println(e.toString());
		}

	}

}
